#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2017/11/23 15:33
# @Author  : Beam
# @Site    : 
# @File    : asset.py
# @Software: PyCharm

from django.shortcuts import HttpResponse,render,redirect
from django.views import View  #CBV模式写法
from django.utils.decorators import method_decorator  #非常重要的一个方法，引用装饰器类
from django.views.decorators.csrf import csrf_exempt  #z这样不需要做csrf的验证了，post请求也可以直接过来不验证

'''
@用于做api认证功能
'''
#from config import setting
from func import authapi
import json
class AssetView(View):
	@method_decorator(authapi.api_auth)
	def get(self,request,*args,**kwargs):
		result = json.loads(request.body)
		print(type(result))
		print(result['return'])

		return HttpResponse('get ok')

	@method_decorator(csrf_exempt)
	def post(self,request,*args,**kwargs):
		#测试
		print(request.body)
		return HttpResponse('post ok')

